
#include "Thread.h"
#include <stdio.h>
#include <pthread.h>

using namespace std;

void Thread::start() {
    int result;

    result = pthread_create(&m_t,
            NULL, //default attributes will be used
            Thread::thread_entrypoint, //notice no ()
            this);
    if (result != 0) {
        printf("Could not create thread \n");
    }
}

void* Thread::thread_entrypoint(void *arg) {
    Thread *my_this = (Thread *) arg;
    my_this->run();
    return NULL;
}
